/*
 * @Description: 组合继承
 * @Author: rendc
 * @Date: 2021-09-03 15:09:50
 * @LastEditors: rendc
 * @LastEditTime: 2021-09-03 15:17:37
 */
function Animal (name, age) {
  this.name = name;
  this.age = age;
  this.sayAge = function () {
    console.log(this.age);
  }
}
Animal.prototype = {
  constructor: Animal,
  sayName: function () {
    console.log("hello,my name is" + this.name);
  }
}
function Dog (name, age, type) {
  // 经典继承
  Animal.call(this, name, age);
  this.type = type;
}
// 原型链继承
Dog.prototype = new Animal();
Dog.prototype.constructor = Dog;
Dog.prototype.sayType = function () {
  console.log(this.type);
}
var dog = new Dog("🌸", 1, "哈士奇");

console.log(dog);
dog.sayName();
dog.sayType();
dog.sayAge();
